package cn.xkai.exercise.c;

/**
 * @description: 删除排序数组中的重复项 II
 * @author: kaixiang
 * @date: 2022-07-28
 **/
public class Solution108 {
    public static int removeDuplicates(int[] nums) {
        int k = 2;
        int i = 0;
        for (int n : nums) {
            if (i < k || n > nums[i - k]) {
                nums[i++] = n;
            }
        }
        return i;
    }
}
